require 'watir'
include Watir
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'watir/testcase'
require 'watir/contrib/enabled_popup'
class TC_Forums < Test::Unit::TestCase
  def test_19
=begin
    $ie.goto($UniVar)
    $ie.refresh()

    $ie.link(:text, 'Control Panel').click
    $ie.link(:text, 'Administration').click
    $ie.table(:index, 7).click
    $ie.link(:index, 13).click
    $ie.wait()
    $ie.text_field(:index, 1).value = "ztemp forum"
    $ie.link(:text, 'Save').click
    
    $ie.link(:text, 'Create New Forum').click
    $ie.text_field(:index, 1).value = "ztemp forum 2"
    $ie.link(:text, 'Save').click
    $ie.link(:text, 'Exit Control Panel and Return to Site').click
    
    $ie.link(:text, 'Sign out').click
    $ie.link(:text, 'Join').click
    
    $ie.text_field(:index, 2).set('temp1')
    $ie.text_field(:index, 3).set('temp11')
    $ie.text_field(:index, 4).set('temp11')
    $ie.text_field(:index, 5).set('temp1@telligent.com')
    $ie.text_field(:index, 6).set('temp1@telligent.com')
    
   $ie.button(:id, /ctl00_bcr_ctl01_ctl00_CreateAccount/).click
#    $ie.button(:id, /ctl00_bcr_ctl00___CreateAccount/).click    

    $ie.link(:text, 'Forums').click
    assert($ie.link(:text, 'ztemp forum').exists?)
    $ie.link(:text, 'ztemp forum').click
    $ie.link(:text, 'Write a New Post').click

#    $ie.text_field(:id, /ctl00_ctl00_bcr_bcr_PostForm_ctl04_PostSubject/).value = "temp subject"
    $ie.text_field(:index, 2).value = "temp subject"
    temp_var = "temp body"
    $ie.ie.Document.parentWindow.execScript("tinyMCE.getInstanceById(tinyMCE.getEditorId('mce_editor_0')).execCommand('mceSetContent', false, '" + temp_var + "')")        

#    $ie.button(:id, /ctl00_ctl00_bcr_bcr_PostForm_ctl04_PostButton/).click
    $ie.button(:id, /ctl00_ctl01_bcr_PostForm___PostButton/).click



    $ie.link(:text, 'Reply').click
    temp_var = "temp body first reply"
    $ie.ie.Document.parentWindow.execScript("tinyMCE.getInstanceById(tinyMCE.getEditorId('mce_editor_0')).execCommand('mceSetContent', false, '" + temp_var + "')")            
    
#    $ie.button(:id, /ctl00_ctl00_bcr_bcr_PostForm_ctl04_PostButton/).click
    $ie.button(:id, /ctl00_ctl01_bcr_PostForm___PostButton/).click



    $ie.link(:text, 'Reply').click
    temp_var = "temp body second reply"
    $ie.ie.Document.parentWindow.execScript("tinyMCE.getInstanceById(tinyMCE.getEditorId('mce_editor_0')).execCommand('mceSetContent', false, '" + temp_var + "')")            
    
#    $ie.button(:id, /ctl00_ctl00_bcr_bcr_PostForm_ctl04_PostButton/).click
    $ie.button(:id, /ctl00_ctl01_bcr_PostForm___PostButton/).click
  
    $ie.link(:text, 'Home').click
    $ie.link(:text, 'Forums').click
    $ie.link(:text, 'Personalize').click
    assert($ie.link(:text, 'Return To Personalized View').exists?)
    
    assert($ie.findElement(:links, :text,Yes, 1).exists?)
    assert($ie.findElement(:links, :text,Yes, 2).exists?)
    assert($ie.findElement(:links, :text,Yes, 3).exists?)  
    assert($ie.findElement(:links, :text,Yes, 4).exists?)
    assert($ie.findElement(:links, :text,Yes, 5).exists?)
    assert($ie.findElement(:links, :text,Yes, 6).exists?)
    assert($ie.findElement(:links, :text,Yes, 7).exists?)

    $ie.findElement(:links, :index, 1)

      $ie.goto($UniVar + '/controlpanel/forums/Forums.aspx')
      $ie.div(:index, 62).click
      $ie.div(:index, 62).click    
      $ie.link(:text, 'Delete').click_no_wait
      hwnd = $ie.enabled_popup(20)
        if(hwnd)
          w = WinClicker.new
          w.clickWindowsButton_hwnd(hwnd, "OK")
        end
      $ie.wait()
      $ie.refresh()
      $ie.refresh()
      $ie.div(:index, 62).click
      $ie.div(:index, 62).click    
      $ie.link(:text, 'Delete').click_no_wait
      hwnd = $ie.enabled_popup(20)
        if(hwnd)
          w = WinClicker.new
          w.clickWindowsButton_hwnd(hwnd, "OK")
        end
=end
$ie.goto('http://localhost/cs/forums/default.aspx?personalize=true')

    $ie.link(:text, :index, 'Yes', 2).click

  
end